<!--
	作者：956911785@qq.com
	时间：2018-10-18
	描述：社团活动辅导班-添加
-->

<template>
	<Tcontent ref="Tcontent" :teas="params" :title="title" @addsave="addsave"></Tcontent>
</template>

<script>
	import Tcontent from "./Tcontent";
	export default {
		name:"addhdfdfdb",
		props: {
    		
    	},
		data() {
			return {
				params:{
					sid:"",
					mc:"",
					jj:"",
					fy:"",
					xe:"",
					sksj:"",
					skdd:"",
					bmzlsm:'',
					stksf:[],
					teachers:[]
				},
				title:'新增辅导班'
			}
		},
		components: {
			Tcontent
		},
		methods: {
			addsave:function(datas){
				const stkdata={...datas};
				
				var stksf=[];
				const sfdata=stkdata.stksf;
				for(var i=0;i<sfdata.length;i++){
					var sfxm=sfdata[i];
					stksf.push(sfxm);
				}
				
				
				var stk_teacher=[];
				const teadata=stkdata.teachers;
				for(var i=0;i<teadata.length;i++){
					var tea={
						tid:teadata[i].tid
					};
					stk_teacher.push(tea);
				}
				
				const params={
					mc:stkdata.mc,
					jj:stkdata.jj,
					fy:stkdata.fy,
					xe:stkdata.xe,
					sksj:stkdata.sksj,
					skdd:stkdata.skdd,
					bmzlsm:stkdata.bmzlsm,
					stksf:JSON.stringify(stksf),
					stk_teacher:JSON.stringify(stk_teacher),
				};
                this.$http.post("/host/stgl/sthd/InsertStkfdb.html",params)
				.then(result => {
					if(result){
						this.$Modal.success({
                            title: "提示",
                            content: "添加成功！"
                       });
                       this.$emit("reload");
                       this.$refs.Tcontent.closeModal();
					}else{
						this.$Modal.error({
                            title: "提示",
                            content: "添加失败，请联系管理员！"
                       });	
					}
				});
	        },
			openmodal(){
				this.$refs.Tcontent.modal0 = true;
			}
		},
		mounted() {

		},
		watch:{
			
		},
		computed: {
			
		}
		
	}
</script>

<style scoped="scoped">
	
</style>



